choicescriptdevfandomcom-20200216-history
Stat chart
The *stat_chart command is able to display variables easily and in several different ways. This command is usually used in your choicescript_stats.txt file, which governs the display of the Stats Screen and may be found in the "scenes" (..mygame\scenes) folder, but it can also be used in any ordinary scenes if required. There are no limits to how many times this command can be used in a single file. Displaying stats Let's say you have three variables: the "name" string variable containing the name of the player-character; the "intelligence" numeric variable containing a number from 0 to 100; and the "wisdom" numeric variable, also a value between 0 and 100. This is how they might be used within a *stat_chart for display purposes: *stat_chart text name percent intelligence percent wisdom Which will display as: But what if you wanted your stat names to be capitalized in different ways? Simply type those variable names exactly as you want them to appear, so that you might end up with something like this: *stat_chart text NAME percent Intelligence percent wIsDoM Which will display as: But let's say you wanted "Intelligence" to be called "Cleverness", but don't want to change the actual variable's name. Anything added to the line after the variable itself ''becomes the new wording for the chart, so you can type: *stat_chart text name percent intelligence Cleverness percent wisdom Which will display as: Note that this works with multiple words too. Displaying opposed pairs But let's say you wanted to write something at the end of a stat bar. For example, if you wanted to make an 'opposed pair' out of intelligence and stupidity. Simply change the 'percent' line to 'opposed_pair' and add another line, indented one more level, and the text intended to be displayed ''opposite the variable. So something like this: *stat_chart text name opposed_pair intelligence stupidity percent wisdom Which will display as: Note that there is no actual "stupidity" variable; that is just text being displayed at the end of that stat bar. In opposed pairs you can also make the variable "intelligence" display as "Cleverness" instead, for example: *stat_chart text name opposed_pair intelligence Cleverness Stupidity percent wisdom Displays as: Note Any numeric variable used for displaying a percentile bar within a *stat_chart should not be allowed -- as a result of scripting elsewhere -- to fall outside the 0-100 range, otherwise, it will have an adverse effect on the appearance of a percentile bar. For example, if "intelligence" is set to 150, the bar will look like this: There are two ways to make sure this never happens. The easiest is to use the Fairmath system, which makes it harder to increase high stats and decrease low stats. Using fairmath ensures the stats will always stay between 0 and 100. If you do not wish to use fairmath, it is possible to make sure the stats are capped at 100 by calling a subroutine with the *gosub command every time a stat is modified in the game. This technique is easy to set up for each scene, and is described on the *gosub page. Category:Commands